In recent years, in the field of image recognition, processing has been performed in which the distance between a target object and a camera in a three-dimensional space is measured and information about the distance is used for image recognition processing. For the processing, e.g., a method based on a stereo camera configuration, a method based on Time of Flight (TOF), or the like is used.
In the method based on the stereo camera configuration, for example, the distance to a target object is measured using a triangulation method or the like based on image data from two cameras. In accordance with the method, every time the distance is measured, the image data from the two cameras needs to be processed, which may result in a lower processing speed. On the other hand, in the method based on TOF, laser light output from a light source is reflected by a target object and the distance to the target object is obtained based on the time of travel (delay time) of the light till the light reaches a sensor and the speed of the light. In accordance with the method, since one point is irradiated with the laser light, only the distance to a given one point at the target object can be measured. Note that, by swinging the laser light, the distance to a plane at the target object can be measured but, since the measurement is not performed by observation at a single time, the method is not suitable for the measurement of the distance to a moving target object.
Accordingly, for example, a diffraction grating is provided at the leading end of the laser light and pattern light having a plurality of spot beams is projected on a target object so that, based on the amount of movement of each of the spot beams from a reference position, the distance to a plane at the target object is measured (e.g., Japanese Patent Application Publication No. 2002-175582). For example, the position of the spot beam in image data when the target object is away from a laser light output unit by a predetermined reference distance is assumed to be the reference position. For example, at this time, when the target object is located at a distance longer than the reference distance, the position of the spot beam in the image data is located rightward of the reference position. For example, on the other hand, when the target object is located at a distance shorter than the reference distance, the position of the spot beam in the image data is located leftward of the reference position. Thus, in accordance with the distance to the target object, the position of the spot beam in the image data moves. Based on the amount of the movement thereof, the distance to the target object is calculated.